﻿
#region NameSpace
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using UserManage;
using FrameWorkMain;
#endregion

public partial class Modules_UserManager_Inbox : System.Web.UI.UserControl
{
    #region Fields
    #endregion

     
    FrameWorkMain.FrameWorkMain frameWork = new FrameWorkMain.FrameWorkMain();
    UserManager _userSearch = new UserManager();

    //public event EventHandler<CustomerSelectedArgs> CustomerSelected;

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        if (!IsPostBack)
        {
            //Set display = none to prevent page load flicker
            pnlPopupContainer.Style.Add("display", "none");
        }
    }
   
    #region Events
     protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            PopulateInBox();
        PopulateInBox1();
    }

    protected void lbStatus_Click(object sender, EventArgs e)
    {
        LinkButton ProductIdButton = sender as LinkButton;
        int uniqId = Convert.ToInt32(ProductIdButton.CommandArgument);
    }
    #endregion

    #region Methods
    /// <summary>
    /// Populate Inbox by Corresponding UserId
    /// </summary>
    void PopulateInBox()
    {

        //DataSet inboxDS = new DataSet();
        //inboxDS=frameWork.GetInboxEntries();
        //grvInbox.DataSource = inboxDS;
        //grvInbox.DataBind();
    }

    void PopulateInBox1()
    {
        Session["UserManager_UserSearch"] = "BlankSearch";
        Search();
        //DataSet inboxDS = new DataSet();
        //inboxDS = frameWork.GetInboxEntries();
        //grdTest.DataSource = inboxDS;
        //grdTest.DataBind();
    }

    #endregion



    protected void grvInbox_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            e.Row.Attributes.Add("onmouseover", "MouseEvents(this, event)");

            e.Row.Attributes.Add("onmouseout", "MouseEvents(this, event)");

        }

        if (e.Row.RowType == DataControlRowType.EmptyDataRow)
            e.Row.CssClass = "grid-view-header";
        if (e.Row.RowType == DataControlRowType.Header)
            e.Row.CssClass = "grid-view-header";

        //Add CSS class on normal row.
        if (e.Row.RowType == DataControlRowType.DataRow &&
                  e.Row.RowState == DataControlRowState.Normal)
            e.Row.CssClass = "grid-view-normal";

        //Add CSS class on alternate row.
        if (e.Row.RowType == DataControlRowType.DataRow &&
                  e.Row.RowState == DataControlRowState.Alternate)
            e.Row.CssClass = "grid-view-alternate";
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        if (txtCustomerName.Text == string.Empty)
            Session["UserManager_UserSearch"] = "BlankSearch";
        else
            Session["UserManager_UserSearch"] = txtCustomerName.Text.Trim();

        Search();
    }

    void Search()
    {
        try
        {
            //upnlAdvanceSearch.Visible = false;
            string toSearch;

            //  if (txtSearch.Text == string.Empty)


            DataSet ds = new DataSet();
            _userSearch.SearchUser(Session["UserManager_UserSearch"].ToString(), out ds);
            grdTest.DataSource = ds;
            //if (ds.Tables[0].Rows.Count > 0)
            //{
            grdTest.DataBind();
            //}
            //else
            //{
            //    gvwUserDetails.Visible = true;
            //    gvwUserDetails.EmptyDataText = "No Records Found";
            ////    Response.Write("<script>alert('No User Found !')</script>");
            //}

        }
        catch (Exception exp)
        {
            Session["ERRTITLE"] = "Search User Failed";
            Session["ERRDET"] = exp.Message;
            Response.Redirect("ErrorPage.aspx");
        }
    }

    protected void btnEmployee_Click(object sender, EventArgs e)
    {

    }
}
